package xcmg.device.infra.enums;

/**
 * 代理商采购计划状态枚举
 *
 * @author wangyong 2019-04-18
 */

public enum AgentPlanStatusEnum {
  //                        是否可删除、修改、审核
  DRAFT(        0, "草拟",     true,  true,  false),
  WAIT_AUDIT(   1, "待审核",   true,  false, true),
  AUDIT_PASSED( 2, "审核通过", false, false,  false),
  RETURN_UPDATE(3, "返回修改", true,  true,  false),
  SUMMARY(      4, "已汇总",   false, false, false);

  private Integer status;

  private String desc;

  /**
   * 是否可删除
   */
  private boolean canDelete;

  /**
   * 是否可修改
   */
  private boolean canUpdate;

  /**
   * 是否可审核
   */
  private boolean canAudit;

  /**
   * 根据状态码获取枚举实例
   *
   * @param status
   */
  public static AgentPlanStatusEnum getByStatus(Integer status) {
    for (AgentPlanStatusEnum statusEnum : AgentPlanStatusEnum.values()) {
      if (statusEnum.getStatus().equals(status)) {
        return statusEnum;
      }
    }
    return null;
  }

  AgentPlanStatusEnum(Integer status, String desc, boolean canDelete, boolean canUpdate,
      boolean canAudit) {
    this.status = status;
    this.desc = desc;
    this.canDelete = canDelete;
    this.canUpdate = canUpdate;
    this.canAudit = canAudit;
  }

  public Integer getStatus() {
    return status;
  }

  public void setStatus(Integer status) {
    this.status = status;
  }

  public String getDesc() {
    return desc;
  }

  public void setDesc(String desc) {
    this.desc = desc;
  }

  public boolean isCanDelete() {
    return canDelete;
  }

  public void setCanDelete(boolean canDelete) {
    this.canDelete = canDelete;
  }

  public boolean isCanUpdate() {
    return canUpdate;
  }

  public void setCanUpdate(boolean canUpdate) {
    this.canUpdate = canUpdate;
  }

  public boolean isCanAudit() {
    return canAudit;
  }

  public void setCanAudit(boolean canAudit) {
    this.canAudit = canAudit;
  }
}
